home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / System / XFD / Developer / Sources / ASM / D815.a < prev    next >
Encoding:
Text File  |  2001-09-16  |  2.9 KB  |  144 lines

  1. *******************************************************
  2. **     XFD external decruncher for D815 Cruncher     **
  3. **        written by Mr. Larmer / Wanted Team        **
  4. **       shortened and fixed by SDI in 1999           **
  5. *******************************************************
  6.  
  7.         INCLUDE    "AINCLUDE:IncDirs.i"
  8.         INCLUDE    "libraries/xfdmaster.i"
  9.  
  10.         * head function for tests
  11. *        INCLUDE    "xfdExeHead.a"
  12.  
  13. ; xfdForeman structure MUST be first thing in all external decrunchers
  14.  
  15. ForeMan        moveq    #-1,d0        ;security
  16.         rts
  17.         dc.l    XFDF_ID        ;id
  18.         dc.w    1        ;version
  19.         dc.w    0
  20.         dc.l    0,0        ;private
  21.         dc.l    S_D815        ;first slave
  22.  
  23. **************************************************
  24.  
  25.         dc.b    "$VER: D815 2.0 (14.12.1999)",0
  26. N_D815        dc.b    "(0815) and (D815) Data Cruncher",0
  27.         even
  28.  
  29. **************************************************
  30.  
  31. ; xfdSlave structure: this one doesn't support segment decrunching
  32.  
  33. S_D815        dc.l    0        ;no more slaves
  34.         dc.w    2        ;version
  35.         dc.w    39        ;master version
  36.         dc.l    N_D815        ;name
  37.         dc.w    XFDPFF_DATA|XFDPFF_USERTARGET|XFDPFF_RECOGLEN
  38.         dc.w    0
  39.         dc.l    RB_D815        ;recog buffer
  40.         dc.l    DB_D815        ;decrunch buffer
  41.         dc.l    0        ;recog segment
  42.         dc.l    0        ;decrunch segment
  43.         dc.w    0,0
  44.         dc.l    12+2
  45.  
  46. ;-------------------------------------------------
  47.  
  48. ; Recog buffer function: receives buffer + length in a0/d0
  49.  
  50. RB_D815        MOVEQ    #0,D0
  51.         move.l    (A0),D1
  52.         and.l    #$FFFFFF,D1
  53.         cmp.l    #"815",D1
  54.         bne.s    .Exit
  55.         MOVE.L    4(A0),D0
  56.         MOVE.L    D0,xfdrr_FinalTargetLen(A1)
  57.         ADD.L    #$1000,D0
  58.         MOVE.L    D0,xfdrr_MinTargetLen(A1)
  59.         MOVEQ    #12,D0
  60.         ADD.L    8(A0),D0
  61.         MOVE.L    D0,xfdrr_MinSourceLen(A1)
  62.         moveq    #1,d0
  63. .Exit        rts
  64.  
  65. ;-------------------------------------------------
  66.  
  67. ;Decrunch buffer function: receives bufferinfo in a0
  68.  
  69. DB_D815        movem.l    d2-d7/a2-a6,-(a7)
  70.         MOVE.L    xfdbi_UserTargetBuf(a0),a1
  71.         MOVE.L    A1,A2
  72.         ADD.L    xfdbi_TargetBufSaveLen(a0),A2 * last $1000 bytes are table buffer
  73.         move.l    xfdbi_SourceBuffer(a0),a0
  74.  
  75.         addq.l    #8,a0
  76.         move.l    (A0)+,D4
  77.         movea.l    A2,A3
  78.         move.w    #$FED,D0
  79.         moveq    #$20,D1
  80. lbC00000E:
  81.         move.b    D1,(A3)+
  82.         dbra    D0,lbC00000E
  83.         moveq    #0,D6
  84.         move.w    #$FF00,D7
  85.         movea.l    A0,A3
  86.         movea.l    A2,A5
  87.         lea    $1000(A2),A4
  88.         adda.w    #$FEE,A2
  89. lbC000026:
  90.         lsr.w    #1,D6
  91.         btst    #8,D6
  92.         bne.s    lbC000036
  93.         subq.l    #1,D4
  94.         bmi.s    lbC000088
  95.         move.w    D7,D6
  96.         move.b    (A3)+,D6
  97. lbC000036:
  98.         btst    #0,D6
  99.         beq.s    lbC00004E
  100.         subq.l    #1,D4
  101.         bmi.s    lbC000088
  102.         move.b    (A3)+,D0
  103.         move.b    D0,(A1)+
  104.         move.b    D0,(A2)+
  105.         cmpa.l    A2,A4
  106.         bne.s    lbC000026
  107.         movea.l    A5,A2
  108.         bra.s    lbC000026
  109.  
  110. lbC00004E:
  111.         subq.l    #1,D4
  112.         bmi.s    lbC000088
  113.         moveq    #0,D1
  114.         move.b    (A3)+,D1
  115.         subq.l    #1,D4
  116.         bmi.s    lbC000088
  117.         move.b    (A3)+,D2
  118.         move.w    #$F0,D3
  119.         and.b    D2,D3
  120.         lsl.w    #4,D3
  121.         or.w    D3,D1
  122.         andi.w    #15,D2
  123.         addq.w    #2,D2
  124.         lea    0(A5,D1.W),A6
  125. lbC000070:
  126.         move.b    (A6)+,D0
  127.         cmpa.l    A6,A4
  128.         bne.s    lbC000078
  129.         movea.l    A5,A6
  130. lbC000078:
  131.         move.b    D0,(A1)+
  132.         move.b    D0,(A2)+
  133.         cmpa.l    A2,A4
  134.         bne.s    lbC000082
  135.         movea.l    A5,A2
  136. lbC000082:
  137.         dbra    D2,lbC000070
  138.         bra.s    lbC000026
  139.  
  140. lbC000088:    moveq    #1,d0
  141.         movem.l    (a7)+,d2-d7/a2-a6
  142.         rts
  143.         END
  144.